package leetcode_201_300;

public class LeeCode_258 {
    public static void main(String[] args) {
        System.out.println(addDigits(38));
    }
    private static int addDigits(int num) {
        while (num >= 10){
            int tn = 0;
            while (num != 0){
                tn += num % 10;
                num /= 10;
            }
            num = tn;
        }
        return num;
    }
}
